cc.Class({
    extends: cc.Component,

    properties: {
        magnifierCamera: cc.Node,
        showSprite: cc.Node
    },

    // LIFE-CYCLE CALLBACKS:

    onLoad () {
        // 创建渲染纹理，并设置纹理大小同显示屏(showSprite)大小一样
        let texture = new cc.RenderTexture();
        texture.initWithSize(this.showSprite.width, this.showSprite.height);
        
        // 设置摄像机缩放比率和目标投影纹理
        this.magnifierCamera.getComponent(cc.Camera).zoomRatio = 8;
        this.magnifierCamera.getComponent(cc.Camera).targetTexture = texture;

        // 显示屏显示纹理
        this.showSprite.getComponent(cc.Sprite).spriteFrame.setTexture(texture);
    },
});
